-----------------------------------------------------------------------------------------
      name:  <unnamed>
       log:  D:\Ellen\Dropbox\Pajaro_AgInnovation\Submission\JAERE\Replication_Code\Log\E
> vent_study_log.log
  log type:  text
 opened on:  29 Nov 2023, 14:03:05

. 
. ***Robustness ES without Q3 uses different dataset -- rename year_short to year_run and
>  rerun the first event study, change name
. *use "Data\Parcel_clean_yearshort_20230626.dta", clear
. *rename year_short year_run
. 
. *Balance the panel
. bysort parcelnum: gen ntime = [_N]

. sum ntime

    Variable |        Obs        Mean    Std. Dev.       Min        Max
-------------+---------------------------------------------------------
       ntime |     28,848    5.919024    6.578618          1         15

. keep if ntime==`r(max)'
(19,488 observations deleted)

. 
. *To get total acreage number for counterfactual analysis = 24,419
. preserve

. collapse (sum) parcel_size_fixed area_acres, by(year)

. sum  parcel_size_fixed area_acres

    Variable |        Obs        Mean    Std. Dev.       Min        Max
-------------+---------------------------------------------------------
parcel_siz~d |         15    14657.82    9153.329          0   20431.17
  area_acres |         15     24418.9           0    24418.9    24418.9

. restore

. 
. ********************************************************************************
. *1.1 Generate dummy variables
. ********************************************************************************
. 
. *Generate event periods 
.         *year_run=6 is Q42010-Q32011
. gen event_time = 0

. sum year_run

    Variable |        Obs        Mean    Std. Dev.       Min        Max
-------------+---------------------------------------------------------
    year_run |      9,360           8    4.320725          1         15

. forvalues j = 1/`r(max)' {
  2. replace event_time = -`j' if year_run == 6 - `j'
  3. replace event_time = `j' if year_run == 6 + `j'
  4. }
(624 real changes made)
(624 real changes made)
(624 real changes made)
(624 real changes made)
(624 real changes made)
(624 real changes made)
(624 real changes made)
(624 real changes made)
(624 real changes made)
(624 real changes made)
(0 real changes made)
(624 real changes made)
(0 real changes made)
(624 real changes made)
(0 real changes made)
(624 real changes made)
(0 real changes made)
(624 real changes made)
(0 real changes made)
(0 real changes made)
(0 real changes made)
(0 real changes made)
(0 real changes made)
(0 real changes made)
(0 real changes made)
(0 real changes made)
(0 real changes made)
(0 real changes made)
(0 real changes made)
(0 real changes made)

. sum year_run

    Variable |        Obs        Mean    Std. Dev.       Min        Max
-------------+---------------------------------------------------------
    year_run |      9,360           8    4.320725          1         15

. 
. *Generate 5 pre period interaction terms
. forvalues j = 1/`r(max)' {
  2. gen minus`j' = 0
  3. replace minus`j' = 1 if inside == 1 & event_time == -`j'
  4. }
(71 real changes made)
(71 real changes made)
(71 real changes made)
(71 real changes made)
(71 real changes made)
(0 real changes made)
(0 real changes made)
(0 real changes made)
(0 real changes made)
(0 real changes made)
(0 real changes made)
(0 real changes made)
(0 real changes made)
(0 real changes made)
(0 real changes made)

. 
. *Generate 6 post period interaction terms
. forvalues j = 1/`r(max)' {
  2. gen plus`j' = 0
  3. replace plus`j' = 1 if inside == 1 & event_time == `j'
  4. }
(70 real changes made)
(70 real changes made)
(70 real changes made)
(70 real changes made)
(70 real changes made)
(70 real changes made)
(70 real changes made)
(70 real changes made)
(70 real changes made)
(0 real changes made)
(0 real changes made)
(0 real changes made)
(0 real changes made)
(0 real changes made)
(0 real changes made)

. 
. *Generate treatment event interaction
. **The date of the price split = 2010 
. generate event_treatment = 0

. replace event_treatment  = 1 if inside == 1 & event_time==0
(71 real changes made)

. 
. 
. *Drop missing variables
. foreach var of varlist plus* minus* {
  2. summ `var'
  3.    if `r(sum)' == 0  {
  4.             drop `var'
  5.            }
  6.        else { 
  7.                }
  8.          }

    Variable |        Obs        Mean    Std. Dev.       Min        Max
-------------+---------------------------------------------------------
       plus1 |      9,360    .0074786    .0861597          0          1

    Variable |        Obs        Mean    Std. Dev.       Min        Max
-------------+---------------------------------------------------------
       plus2 |      9,360    .0074786    .0861597          0          1

    Variable |        Obs        Mean    Std. Dev.       Min        Max
-------------+---------------------------------------------------------
       plus3 |      9,360    .0074786    .0861597          0          1

    Variable |        Obs        Mean    Std. Dev.       Min        Max
-------------+---------------------------------------------------------
       plus4 |      9,360    .0074786    .0861597          0          1

    Variable |        Obs        Mean    Std. Dev.       Min        Max
-------------+---------------------------------------------------------
       plus5 |      9,360    .0074786    .0861597          0          1

    Variable |        Obs        Mean    Std. Dev.       Min        Max
-------------+---------------------------------------------------------
       plus6 |      9,360    .0074786    .0861597          0          1

    Variable |        Obs        Mean    Std. Dev.       Min        Max
-------------+---------------------------------------------------------
       plus7 |      9,360    .0074786    .0861597          0          1

    Variable |        Obs        Mean    Std. Dev.       Min        Max
-------------+---------------------------------------------------------
       plus8 |      9,360    .0074786    .0861597          0          1

    Variable |        Obs        Mean    Std. Dev.       Min        Max
-------------+---------------------------------------------------------
       plus9 |      9,360    .0074786    .0861597          0          1

    Variable |        Obs        Mean    Std. Dev.       Min        Max
-------------+---------------------------------------------------------
      plus10 |      9,360           0           0          0          0

    Variable |        Obs        Mean    Std. Dev.       Min        Max
-------------+---------------------------------------------------------
      plus11 |      9,360           0           0          0          0

    Variable |        Obs        Mean    Std. Dev.       Min        Max
-------------+---------------------------------------------------------
      plus12 |      9,360           0           0          0          0

    Variable |        Obs        Mean    Std. Dev.       Min        Max
-------------+---------------------------------------------------------
      plus13 |      9,360           0           0          0          0

    Variable |        Obs        Mean    Std. Dev.       Min        Max
-------------+---------------------------------------------------------
      plus14 |      9,360           0           0          0          0

    Variable |        Obs        Mean    Std. Dev.       Min        Max
-------------+---------------------------------------------------------
      plus15 |      9,360           0           0          0          0

    Variable |        Obs        Mean    Std. Dev.       Min        Max
-------------+---------------------------------------------------------
      minus1 |      9,360    .0075855    .0867683          0          1

    Variable |        Obs        Mean    Std. Dev.       Min        Max
-------------+---------------------------------------------------------
      minus2 |      9,360    .0075855    .0867683          0          1

    Variable |        Obs        Mean    Std. Dev.       Min        Max
-------------+---------------------------------------------------------
      minus3 |      9,360    .0075855    .0867683          0          1

    Variable |        Obs        Mean    Std. Dev.       Min        Max
-------------+---------------------------------------------------------
      minus4 |      9,360    .0075855    .0867683          0          1

    Variable |        Obs        Mean    Std. Dev.       Min        Max
-------------+---------------------------------------------------------
      minus5 |      9,360    .0075855    .0867683          0          1

    Variable |        Obs        Mean    Std. Dev.       Min        Max
-------------+---------------------------------------------------------
      minus6 |      9,360           0           0          0          0

    Variable |        Obs        Mean    Std. Dev.       Min        Max
-------------+---------------------------------------------------------
      minus7 |      9,360           0           0          0          0

    Variable |        Obs        Mean    Std. Dev.       Min        Max
-------------+---------------------------------------------------------
      minus8 |      9,360           0           0          0          0

    Variable |        Obs        Mean    Std. Dev.       Min        Max
-------------+---------------------------------------------------------
      minus9 |      9,360           0           0          0          0

    Variable |        Obs        Mean    Std. Dev.       Min        Max
-------------+---------------------------------------------------------
     minus10 |      9,360           0           0          0          0

    Variable |        Obs        Mean    Std. Dev.       Min        Max
-------------+---------------------------------------------------------
     minus11 |      9,360           0           0          0          0

    Variable |        Obs        Mean    Std. Dev.       Min        Max
-------------+---------------------------------------------------------
     minus12 |      9,360           0           0          0          0

    Variable |        Obs        Mean    Std. Dev.       Min        Max
-------------+---------------------------------------------------------
     minus13 |      9,360           0           0          0          0

    Variable |        Obs        Mean    Std. Dev.       Min        Max
-------------+---------------------------------------------------------
     minus14 |      9,360           0           0          0          0

    Variable |        Obs        Mean    Std. Dev.       Min        Max
-------------+---------------------------------------------------------
     minus15 |      9,360           0           0          0          0

. 
. gen del_parcel = delivered/100

. gen total_water = extraction + del_parcel

. 
. ********************************************************************************
. *Figure 4 Panel A: MAIN UNCONDTIIONAL EVENT STUDY DROPPING 2010
. ********************************************************************************
. drop if year_run==5
(624 observations deleted)

. 
. preserve

. xtreg extraction plus* i.year_run#i.county event_treatment i.inside minus5 minus4 minus
> 3 if year_run<12, fe cluster(parcelnum)
note: plus6 omitted because of collinearity
note: plus7 omitted because of collinearity
note: plus8 omitted because of collinearity
note: plus9 omitted because of collinearity
note: 11.year_run#2.county_code omitted because of collinearity

Fixed-effects (within) regression               Number of obs     =      6,240
Group variable: parcelnum                       Number of groups  =        624

R-sq:                                           Obs per group:
     within  = 0.0564                                         min =         10
     between = 0.0282                                         avg =       10.0
     overall = 0.0196                                         max =         10

                                                F(27,623)         =          .
corr(u_i, Xb)  = -0.5732                        Prob > F          =          .

                                    (Std. Err. adjusted for 624 clusters in parcelnum)
--------------------------------------------------------------------------------------
                     |               Robust
          extraction |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
---------------------+----------------------------------------------------------------
               plus1 |  -20.89818   12.60743    -1.66   0.098    -45.65639    3.860019
               plus2 |  -21.79482   11.07972    -1.97   0.050    -43.55294   -.0367018
               plus3 |  -11.18573   12.30707    -0.91   0.364    -35.35409    12.98263
               plus4 |  -36.17754   10.45522    -3.46   0.001     -56.7093   -15.64579
               plus5 |  -34.66203   11.48589    -3.02   0.003    -57.21779   -12.10627
               plus6 |          0  (omitted)
               plus7 |          0  (omitted)
               plus8 |          0  (omitted)
               plus9 |          0  (omitted)
                     |
year_run#county_code |
                1 2  |   .8386691   2.059892     0.41   0.684    -3.206503    4.883841
                2 1  |   12.44625   4.195825     2.97   0.003     4.206576    20.68592
                2 2  |   7.684317   2.361396     3.25   0.001     3.047057    12.32158
                3 1  |   11.40116   3.964493     2.88   0.004     3.615768    19.18654
                3 2  |   7.973908   2.280379     3.50   0.001     3.495746    12.45207
                4 1  |   7.219303   4.420106     1.63   0.103    -1.460809    15.89942
                4 2  |   5.044544   1.986333     2.54   0.011     1.143824    8.945263
                6 1  |  -9.278059   4.039462    -2.30   0.022    -17.21067   -1.345448
                6 2  |  -2.542753   1.668763    -1.52   0.128    -5.819835    .7343295
                7 1  |   3.318283   4.816229     0.69   0.491    -6.139727    12.77629
                7 2  |   3.868149   2.190902     1.77   0.078    -.4342993    8.170596
                8 1  |     6.5003   4.659309     1.40   0.163    -2.649552    15.65015
                8 2  |   6.686214   2.270572     2.94   0.003     2.227311    11.14512
                9 1  |   12.73056    5.28376     2.41   0.016      2.35442    23.10669
                9 2  |    9.10528   1.858422     4.90   0.000     5.455749    12.75481
               10 1  |   3.143975   4.322808     0.73   0.467    -5.345066    11.63302
               10 2  |   2.998723   1.350335     2.22   0.027      .346962    5.650483
               11 1  |  -4.246473   4.921658    -0.86   0.389    -13.91152    5.418576
               11 2  |          0  (omitted)
                     |
     event_treatment |  -17.71847   10.06846    -1.76   0.079     -37.4907     2.05377
            1.inside |  -146.5583   5.380666   -27.24   0.000    -157.1247   -135.9918
              minus5 |   6.221212   9.373546     0.66   0.507    -12.18636    24.62879
              minus4 |   9.984082   8.480653     1.18   0.240    -6.670046    26.63821
              minus3 |   7.911262   8.462891     0.93   0.350    -8.707985    24.53051
               _cons |   80.14486   1.535757    52.19   0.000     77.12897    83.16075
---------------------+----------------------------------------------------------------
             sigma_u |  113.03515
             sigma_e |  37.042632
                 rho |  .90302164   (fraction of variance due to u_i)
--------------------------------------------------------------------------------------

. 
. *TABLE 6*
. esttab using "Tables\Eventstudy_annual_$outputdate.tex", label replace ///
>         se star(* .10 ** .05 *** .01) ///
>         addnote(Table reports results from event study regression. Standard errors are 
> clustered at the parcel level.) ///
>         cells(b(star fmt(2)) se(par fmt(2)))
(output written to Tables\Eventstudy_annual_20231129.tex)

. eststo clear

. 
. *WALD TESTS
. putexcel set "Tables\pairwise_wald_annual_$outputdate.xlsx", replace
Note: file will be replaced when the first putexcel command is issued

. putexcel B1=2011
file Tables\pairwise_wald_annual_20231129.xlsx saved

. putexcel C1=2012
file Tables\pairwise_wald_annual_20231129.xlsx saved

. putexcel D1=2013
file Tables\pairwise_wald_annual_20231129.xlsx saved

. putexcel E1=2014
file Tables\pairwise_wald_annual_20231129.xlsx saved

. putexcel F1=2015
file Tables\pairwise_wald_annual_20231129.xlsx saved

. putexcel A2=2011
file Tables\pairwise_wald_annual_20231129.xlsx saved

. putexcel A3=2012
file Tables\pairwise_wald_annual_20231129.xlsx saved

. putexcel A4=2013
file Tables\pairwise_wald_annual_20231129.xlsx saved

. putexcel A5=2014
file Tables\pairwise_wald_annual_20231129.xlsx saved

. putexcel A6=2015
file Tables\pairwise_wald_annual_20231129.xlsx saved

. *2011 
. lincom _b[event_treat]-_b[plus1]

 ( 1)  - plus1 + event_treatment = 0

------------------------------------------------------------------------------
  extraction |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
         (1) |   3.179717   7.196511     0.44   0.659    -10.95264    17.31207
------------------------------------------------------------------------------

. putexcel C2=(r(t)) 
file Tables\pairwise_wald_annual_20231129.xlsx saved

. lincom _b[event_treat]-_b[plus2]

 ( 1)  - plus2 + event_treatment = 0

------------------------------------------------------------------------------
  extraction |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
         (1) |   4.076353   7.107951     0.57   0.567    -9.882093     18.0348
------------------------------------------------------------------------------

. putexcel D2=(r(t))
file Tables\pairwise_wald_annual_20231129.xlsx saved

. lincom _b[event_treat]-_b[plus3]

 ( 1)  - plus3 + event_treatment = 0

------------------------------------------------------------------------------
  extraction |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
         (1) |  -6.532737   9.322809    -0.70   0.484    -24.84067     11.7752
------------------------------------------------------------------------------

. putexcel E2=(r(t)) 
file Tables\pairwise_wald_annual_20231129.xlsx saved

. lincom _b[event_treat]-_b[plus4]

 ( 1)  - plus4 + event_treatment = 0

------------------------------------------------------------------------------
  extraction |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
         (1) |   18.45908   7.195096     2.57   0.011     4.329497    32.58865
------------------------------------------------------------------------------

. putexcel F2=(r(t)) 
file Tables\pairwise_wald_annual_20231129.xlsx saved

. *2012
. lincom _b[plus1]-_b[plus2]

 ( 1)  plus1 - plus2 = 0

------------------------------------------------------------------------------
  extraction |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
         (1) |   .8966366   8.207854     0.11   0.913    -15.22178    17.01505
------------------------------------------------------------------------------

. putexcel D3=(r(t)) 
file Tables\pairwise_wald_annual_20231129.xlsx saved

. lincom _b[plus1]-_b[plus3]

 ( 1)  plus1 - plus3 = 0

------------------------------------------------------------------------------
  extraction |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
         (1) |  -9.712454   10.10232    -0.96   0.337    -29.55118    10.12628
------------------------------------------------------------------------------

. putexcel E3=(r(t))
file Tables\pairwise_wald_annual_20231129.xlsx saved

. lincom _b[plus1]-_b[plus4]

 ( 1)  plus1 - plus4 = 0

------------------------------------------------------------------------------
  extraction |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
         (1) |   15.27936   9.472984     1.61   0.107    -3.323489    33.88221
------------------------------------------------------------------------------

. putexcel F3=(r(t)) 
file Tables\pairwise_wald_annual_20231129.xlsx saved

. *2013
. lincom _b[plus2]-_b[plus3]

 ( 1)  plus2 - plus3 = 0

------------------------------------------------------------------------------
  extraction |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
         (1) |  -10.60909   8.672315    -1.22   0.222     -27.6396     6.42142
------------------------------------------------------------------------------

. putexcel E4=(r(t))
file Tables\pairwise_wald_annual_20231129.xlsx saved

. lincom _b[plus2]-_b[plus4]

 ( 1)  plus2 - plus4 = 0

------------------------------------------------------------------------------
  extraction |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
         (1) |   14.38272   7.828897     1.84   0.067    -.9915006    29.75695
------------------------------------------------------------------------------

. putexcel F4=(r(t)) 
file Tables\pairwise_wald_annual_20231129.xlsx saved

. *2014
. lincom _b[plus3]-_b[plus4]

 ( 1)  plus3 - plus4 = 0

------------------------------------------------------------------------------
  extraction |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
         (1) |   24.99181   8.369919     2.99   0.003     8.555141    41.42849
------------------------------------------------------------------------------

. putexcel F5=(r(t)) 
file Tables\pairwise_wald_annual_20231129.xlsx saved

. 
. mat coeff = [ _b[minus5]\ _b[minus4] \ _b[minus3] \ 0 \ _b[event_treatment] ///
>                         \ _b[plus1] \ _b[plus2] \ _b[plus3] \ _b[plus4] \_b[plus5]  \_b
> [plus6] \_b[plus7] \_b[plus8] \_b[plus9]]

.                 
. mat se = [ _se[minus5] \ _se[minus4] \ _se[minus3] \ 0  \ _se[event_treatment] ///
> \ _se[plus1] \ _se[plus2] \ _se[plus3] \ _se[plus4] \_se[plus5] \_se[plus6] \_se[plus7]
>  \_se[plus8] \_se[plus9]]

. 
. mat upper=coeff+((1.645)*se)

. mat lower=coeff-((1.645)*se)

. mat x=(-5\-4\-3\-2\0\1\2\3\4\5\6\7\8\9)

. mat data=[coeff,upper,lower,x]

. svmat data

. rename data1 coeff

. rename data2 upper

. rename data3 lower

. rename data4 x

. 
. 
. matrix colnames data=beta highCI loCI year

. matrix list data

data[14,4]
           beta      highCI        loCI        year
 r1   6.2212125   21.640695  -9.1982705          -5
 r2   9.9840822   23.934756  -3.9665917          -4
 r3   7.9112621   21.832717   -6.010193          -3
 r4           0           0           0          -2
 r5  -17.718468  -1.1558459  -34.281089           0
 r6  -20.898184  -.15896521  -41.637404           1
 r7  -21.794821  -3.5686843  -40.020958           2
 r8   -11.18573   9.0593931  -31.430854           3
 r9  -36.177544  -18.978699  -53.376389           4
r10  -34.662028  -15.767733  -53.556323           5
r11           0           0           0           6
r12           0           0           0           7
r13           0           0           0           8
r14           0           0           0           9

. putexcel set "Tables\water_eventstudy_cy_90_$outputdate.xlsx", sheet(annual) replace
Note: file will be replaced when the first putexcel command is issued

. putexcel A1 = matrix(data)
file Tables\water_eventstudy_cy_90_20231129.xlsx saved

. clear

. svmat data, names(col)
number of observations will be reset to 14
Press any key to continue, or Break to abort
number of observations (_N) was 0, now 14

. 
. replace year = 2006 if year ==-5
(1 real change made)

. replace year = 2007 if year ==-4
(1 real change made)

. replace year = 2008 if year ==-3
(1 real change made)

. replace year = 2009 if year ==-2
(1 real change made)

. replace year = 2010 if year ==-1
(0 real changes made)

. replace year = 2011 if year ==0
(1 real change made)

. replace year = 2012 if year ==1
(1 real change made)

. replace year = 2013 if year ==2
(1 real change made)

. replace year = 2014 if year ==3
(1 real change made)

. replace year = 2015 if year ==4
(1 real change made)

. replace year = 2016 if year ==5
(1 real change made)

. replace year = 2017 if year ==6
(1 real change made)

. replace year = 2018 if year ==7
(1 real change made)

. replace year = 2019 if year ==8
(1 real change made)

. replace year = 2020 if year ==9
(1 real change made)

. 
. twoway (rcap loCI highCI year if year <2016) (scatter beta year if year <2016, msymbol(
> triangle) msize(small)), ///
> ytitle(Extraction (AF))  ///
>  scheme(s1color) legend(label (1 90% CI from t-test) label (2 Difference Inside and Out
> side)) ///
>         xtitle(Year) title(A. Annual)  yline(0, lcolor(black)) xlab(2006(2)2014) ylab(-
> 60(20)40)

. 
. graph save "Figures\ES_ann_cy_90_$outputdate.gph", replace
(file Figures\ES_ann_cy_90_20231129.gph saved)

. graph export "Figures\ES_ann_cy_90_$outputdate.png", replace
(file Figures\ES_ann_cy_90_20231129.png written in PNG format)

. restore

. 
. 
. ********************************************************************************
. *WEIGHTED REGRESSION WITH SCALED DEPENDENT VARIABLE
. ********************************************************************************
. {
. drop if year_run==5
(0 observations deleted)
. *UNCONDITIONAL EVENT STUDY
. *MAKE SURE 2010 IS DROPPED BEFORE RUNNING THIS SECTION
. preserve
. xtreg extract_acre plus* i.year_run#i.county event_treatment i.inside minus5 minus4 min
> us3 minus2 [aweight = area_acres] if year_run<11, fe cluster(parcelnum)
note: plus5 omitted because of collinearity
note: plus6 omitted because of collinearity
note: plus7 omitted because of collinearity
note: plus8 omitted because of collinearity
note: plus9 omitted because of collinearity
note: 10.year_run#2.county_code omitted because of collinearity
note: minus2 omitted because of collinearity

Fixed-effects (within) regression               Number of obs     =      5,589
Group variable: parcelnum                       Number of groups  =        621

R-sq:                                           Obs per group:
     within  = 0.0125                                         min =          9
     between = 0.0083                                         avg =        9.0
     overall = 0.0064                                         max =          9

                                                F(24,620)         =          .
corr(u_i, Xb)  = -0.0979                        Prob > F          =          .

                                    (Std. Err. adjusted for 621 clusters in parcelnum)
--------------------------------------------------------------------------------------
                     |               Robust
        extract_acre |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
---------------------+----------------------------------------------------------------
               plus1 |  -.3437667   .2243479    -1.53   0.126    -.7843407    .0968072
               plus2 |  -.3844308   .1992676    -1.93   0.054     -.775752    .0068903
               plus3 |   -.237076   .2203615    -1.08   0.282    -.6698214    .1956695
               plus4 |  -.6083268   .1919864    -3.17   0.002    -.9853491   -.2313044
               plus5 |          0  (omitted)
               plus6 |          0  (omitted)
               plus7 |          0  (omitted)
               plus8 |          0  (omitted)
               plus9 |          0  (omitted)
                     |
year_run#county_code |
                1 2  |  -.0603246   .0610944    -0.99   0.324    -.1803015    .0596524
                2 1  |   .2938191   .0963095     3.05   0.002     .1046868    .4829515
                2 2  |   .1406198   .0632828     2.22   0.027     .0163453    .2648943
                3 1  |   .2699801   .0885072     3.05   0.002     .0961698    .4437904
                3 2  |    .144022   .0608867     2.37   0.018     .0244529    .2635911
                4 1  |    .171582   .1026674     1.67   0.095    -.0300361       .3732
                4 2  |   .0590714   .0532873     1.11   0.268    -.0455741     .163717
                6 1  |   -.214006   .0928274    -2.31   0.021    -.3963002   -.0317118
                6 2  |  -.1649317   .0454713    -3.63   0.000    -.2542283   -.0756352
                7 1  |   .0839809   .1105707     0.76   0.448    -.1331576    .3011193
                7 2  |   .0210825   .0551417     0.38   0.702    -.0872045    .1293696
                8 1  |   .1604587   .1073261     1.50   0.135     -.050308    .3712255
                8 2  |   .1012906   .0539694     1.88   0.061    -.0046944    .2072757
                9 1  |   .3052517   .1213458     2.52   0.012     .0669531    .5435503
                9 2  |   .1783207   .0445114     4.01   0.000     .0909093    .2657321
               10 1  |   .0821345   .0996442     0.82   0.410    -.1135467    .2778156
               10 2  |          0  (omitted)
                     |
     event_treatment |  -.2073293   .1812925    -1.14   0.253     -.563351    .1486924
            1.inside |  -2.027609   .1023134   -19.82   0.000    -2.228532   -1.826686
              minus5 |   .1552387   .1691713     0.92   0.359    -.1769795    .4874569
              minus4 |   .1389138    .154071     0.90   0.368    -.1636505    .4414781
              minus3 |   .1075359   .1549492     0.69   0.488     -.196753    .4118248
              minus2 |          0  (omitted)
               _cons |   2.003603   .0372645    53.77   0.000     1.930423    2.076783
---------------------+----------------------------------------------------------------
             sigma_u |  70.044243
             sigma_e |  1.6939042
                 rho |  .99941551   (fraction of variance due to u_i)
--------------------------------------------------------------------------------------
. 
. mat coeff = [ _b[minus5]\ _b[minus4] \ _b[minus3] \ _b[minus2]  \ _b[event_treatment] /
> //
>                         \ _b[plus1] \ _b[plus2] \ _b[plus3] \ _b[plus4] \_b[plus5]  \_b
> [plus6] \_b[plus7] \_b[plus8] \_b[plus9]]
.                 
. mat se = [ _se[minus5] \ _se[minus4] \ _se[minus3] \ _se[minus2]  \ _se[event_treatment
> ] ///
> \ _se[plus1] \ _se[plus2] \ _se[plus3] \ _se[plus4] \_se[plus5] \_se[plus6] \_se[plus7]
>  \_se[plus8] \_se[plus9]]
. 
. mat upper=coeff+((1.645)*se)
. mat lower=coeff-((1.645)*se)
. mat x=(-5\-4\-3\-2\0\1\2\3\4\5\6\7\8\9)
. mat data=[coeff,upper,lower,x]
. svmat data
. rename data1 coeff
. rename data2 upper
. rename data3 lower
. rename data4 x
. 
. *Produces Column (1) of Table 7; multiply by total acreage to get column (2)
. matrix colnames data=beta highCI loCI year
. matrix list data

data[14,4]
           beta      highCI        loCI        year
 r1    .1552387   .43352551  -.12304811          -5
 r2   .13891377   .39236059  -.11453304          -4
 r3   .10753587   .36242734   -.1473556          -3
 r4           0           0           0          -2
 r5  -.20732933   .09089677  -.50555543           0
 r6  -.34376673   .02528563  -.71281909           1
 r7  -.38443085  -.05663568  -.71222602           2
 r8  -.23707597   .12541875  -.59957069           3
 r9  -.60832679  -.29250923  -.92414435           4
r10           0           0           0           5
r11           0           0           0           6
r12           0           0           0           7
r13           0           0           0           8
r14           0           0           0           9
. putexcel set "Tables\policy_water_eventstudy_cy_95_$outputdate.xlsx", sheet(annual) rep
> lace
Note: file will be replaced when the first putexcel command is issued
. putexcel A1 = matrix(data)
file Tables\policy_water_eventstudy_cy_95_20231129.xlsx saved
. clear
. svmat data, names(col)
number of observations will be reset to 14
Press any key to continue, or Break to abort
number of observations (_N) was 0, now 14
. 
. 
. replace year = 2006 if year ==-5
(1 real change made)
. replace year = 2007 if year ==-4
(1 real change made)
. replace year = 2008 if year ==-3
(1 real change made)
. replace year = 2009 if year ==-2
(1 real change made)
. replace year = 2010 if year ==-1
(0 real changes made)
. replace year = 2011 if year ==0
(1 real change made)
. replace year = 2012 if year ==1
(1 real change made)
. replace year = 2013 if year ==2
(1 real change made)
. replace year = 2014 if year ==3
(1 real change made)
. replace year = 2015 if year ==4
(1 real change made)
. replace year = 2016 if year ==5
(1 real change made)
. replace year = 2017 if year ==6
(1 real change made)
. replace year = 2018 if year ==7
(1 real change made)
. replace year = 2019 if year ==8
(1 real change made)
. replace year = 2020 if year ==9
(1 real change made)
. 
. 
. twoway (rcap loCI highCI year if year <2016) (scatter beta year if year <2016, msymbol(
> triangle) msize(small)), ///
> ytitle(Extraction - weighted (AF/acre)) ///
>  scheme(s1color) legend(label (1 90% CI from t-test) label (2 Difference Inside and Out
> side)) ///
>         xtitle(Year) yline(0, lcolor(black)) xlab(2006(2)2015) 
.         
. graph save "Figures\ES_weight_$outputdate.gph", replace
(file Figures\ES_weight_20231129.gph saved)
. graph export "Figures\ES_weight_$outputdate.png", replace
(file Figures\ES_weight_20231129.png written in PNG format)
. restore
. 
. }

. 
. 
. 
. 
. ********************************************************************************
. *2. SUMMER EVENT STUDY
. ********************************************************************************
. use "Data\Parcel_Clean_20230626.dta", clear

. keep if quarter==3
(32,665 observations deleted)

. 
. *Balance the panel
. bysort parcelnum: gen ntime = [_N]

. sum ntime

    Variable |        Obs        Mean    Std. Dev.       Min        Max
-------------+---------------------------------------------------------
       ntime |     10,936    15.36906    2.064716          1         16

. keep if ntime==`r(max)'
(1,592 observations deleted)

. 
. 
. ********************************************************************************
. *2.1 Generate dummy variables
. ********************************************************************************
. 
. *Generate event periods 
.         *year_run=6 is Q42010-Q32011
. gen event_time = 0

. sum ntime

    Variable |        Obs        Mean    Std. Dev.       Min        Max
-------------+---------------------------------------------------------
       ntime |      9,344          16           0         16         16

. forvalues j = 1/`r(max)' {
  2. replace event_time = -`j' if year== 2011 - `j'
  3. replace event_time = `j' if year == 2011 + `j'
  4. }
(584 real changes made)
(584 real changes made)
(584 real changes made)
(584 real changes made)
(584 real changes made)
(584 real changes made)
(584 real changes made)
(584 real changes made)
(584 real changes made)
(584 real changes made)
(584 real changes made)
(584 real changes made)
(0 real changes made)
(584 real changes made)
(0 real changes made)
(584 real changes made)
(0 real changes made)
(584 real changes made)
(0 real changes made)
(0 real changes made)
(0 real changes made)
(0 real changes made)
(0 real changes made)
(0 real changes made)
(0 real changes made)
(0 real changes made)
(0 real changes made)
(0 real changes made)
(0 real changes made)
(0 real changes made)
(0 real changes made)
(0 real changes made)

. sum ntime

    Variable |        Obs        Mean    Std. Dev.       Min        Max
-------------+---------------------------------------------------------
       ntime |      9,344          16           0         16         16

. 
. *Generate 5 pre period interaction terms
. forvalues j = 1/`r(max)' {
  2. gen minus`j' = 0
  3. replace minus`j' = 1 if inside == 1 & event_time == -`j'
  4. }
(68 real changes made)
(68 real changes made)
(68 real changes made)
(68 real changes made)
(68 real changes made)
(68 real changes made)
(0 real changes made)
(0 real changes made)
(0 real changes made)
(0 real changes made)
(0 real changes made)
(0 real changes made)
(0 real changes made)
(0 real changes made)
(0 real changes made)
(0 real changes made)

. 
. *Generate 6 post period interaction terms
. forvalues j = 1/`r(max)' {
  2. gen plus`j' = 0
  3. replace plus`j' = 1 if inside == 1 & event_time == `j'
  4. }
(68 real changes made)
(68 real changes made)
(68 real changes made)
(68 real changes made)
(68 real changes made)
(68 real changes made)
(68 real changes made)
(68 real changes made)
(68 real changes made)
(0 real changes made)
(0 real changes made)
(0 real changes made)
(0 real changes made)
(0 real changes made)
(0 real changes made)
(0 real changes made)

. 
. *Generate treatment event interaction
. **The date of the price split = 2010 
. generate event_treatment = 0

. replace event_treatment  = 1 if inside == 1 & event_time==0
(68 real changes made)

. 
. 
. *Drop missing variables
. foreach var of varlist plus* minus* {
  2. summ `var'
  3.    if `r(sum)' == 0  {
  4.             drop `var'
  5.            }
  6.        else { 
  7.                }
  8.          }

    Variable |        Obs        Mean    Std. Dev.       Min        Max
-------------+---------------------------------------------------------
       plus1 |      9,344    .0072774    .0850012          0          1

    Variable |        Obs        Mean    Std. Dev.       Min        Max
-------------+---------------------------------------------------------
       plus2 |      9,344    .0072774    .0850012          0          1

    Variable |        Obs        Mean    Std. Dev.       Min        Max
-------------+---------------------------------------------------------
       plus3 |      9,344    .0072774    .0850012          0          1

    Variable |        Obs        Mean    Std. Dev.       Min        Max
-------------+---------------------------------------------------------
       plus4 |      9,344    .0072774    .0850012          0          1

    Variable |        Obs        Mean    Std. Dev.       Min        Max
-------------+---------------------------------------------------------
       plus5 |      9,344    .0072774    .0850012          0          1

    Variable |        Obs        Mean    Std. Dev.       Min        Max
-------------+---------------------------------------------------------
       plus6 |      9,344    .0072774    .0850012          0          1

    Variable |        Obs        Mean    Std. Dev.       Min        Max
-------------+---------------------------------------------------------
       plus7 |      9,344    .0072774    .0850012          0          1

    Variable |        Obs        Mean    Std. Dev.       Min        Max
-------------+---------------------------------------------------------
       plus8 |      9,344    .0072774    .0850012          0          1

    Variable |        Obs        Mean    Std. Dev.       Min        Max
-------------+---------------------------------------------------------
       plus9 |      9,344    .0072774    .0850012          0          1

    Variable |        Obs        Mean    Std. Dev.       Min        Max
-------------+---------------------------------------------------------
      plus10 |      9,344           0           0          0          0

    Variable |        Obs        Mean    Std. Dev.       Min        Max
-------------+---------------------------------------------------------
      plus11 |      9,344           0           0          0          0

    Variable |        Obs        Mean    Std. Dev.       Min        Max
-------------+---------------------------------------------------------
      plus12 |      9,344           0           0          0          0

    Variable |        Obs        Mean    Std. Dev.       Min        Max
-------------+---------------------------------------------------------
      plus13 |      9,344           0           0          0          0

    Variable |        Obs        Mean    Std. Dev.       Min        Max
-------------+---------------------------------------------------------
      plus14 |      9,344           0           0          0          0

    Variable |        Obs        Mean    Std. Dev.       Min        Max
-------------+---------------------------------------------------------
      plus15 |      9,344           0           0          0          0

    Variable |        Obs        Mean    Std. Dev.       Min        Max
-------------+---------------------------------------------------------
      plus16 |      9,344           0           0          0          0

    Variable |        Obs        Mean    Std. Dev.       Min        Max
-------------+---------------------------------------------------------
      minus1 |      9,344    .0072774    .0850012          0          1

    Variable |        Obs        Mean    Std. Dev.       Min        Max
-------------+---------------------------------------------------------
      minus2 |      9,344    .0072774    .0850012          0          1

    Variable |        Obs        Mean    Std. Dev.       Min        Max
-------------+---------------------------------------------------------
      minus3 |      9,344    .0072774    .0850012          0          1

    Variable |        Obs        Mean    Std. Dev.       Min        Max
-------------+---------------------------------------------------------
      minus4 |      9,344    .0072774    .0850012          0          1

    Variable |        Obs        Mean    Std. Dev.       Min        Max
-------------+---------------------------------------------------------
      minus5 |      9,344    .0072774    .0850012          0          1

    Variable |        Obs        Mean    Std. Dev.       Min        Max
-------------+---------------------------------------------------------
      minus6 |      9,344    .0072774    .0850012          0          1

    Variable |        Obs        Mean    Std. Dev.       Min        Max
-------------+---------------------------------------------------------
      minus7 |      9,344           0           0          0          0

    Variable |        Obs        Mean    Std. Dev.       Min        Max
-------------+---------------------------------------------------------
      minus8 |      9,344           0           0          0          0

    Variable |        Obs        Mean    Std. Dev.       Min        Max
-------------+---------------------------------------------------------
      minus9 |      9,344           0           0          0          0

    Variable |        Obs        Mean    Std. Dev.       Min        Max
-------------+---------------------------------------------------------
     minus10 |      9,344           0           0          0          0

    Variable |        Obs        Mean    Std. Dev.       Min        Max
-------------+---------------------------------------------------------
     minus11 |      9,344           0           0          0          0

    Variable |        Obs        Mean    Std. Dev.       Min        Max
-------------+---------------------------------------------------------
     minus12 |      9,344           0           0          0          0

    Variable |        Obs        Mean    Std. Dev.       Min        Max
-------------+---------------------------------------------------------
     minus13 |      9,344           0           0          0          0

    Variable |        Obs        Mean    Std. Dev.       Min        Max
-------------+---------------------------------------------------------
     minus14 |      9,344           0           0          0          0

    Variable |        Obs        Mean    Std. Dev.       Min        Max
-------------+---------------------------------------------------------
     minus15 |      9,344           0           0          0          0

    Variable |        Obs        Mean    Std. Dev.       Min        Max
-------------+---------------------------------------------------------
     minus16 |      9,344           0           0          0          0

. 
. drop if year==2010
(584 observations deleted)

. *Drop Q42009-Q32010 because of anticipation
. 
. *UNCONDITIONAL SUMMER EVENT STUDY
. ********************************************************************************
. *Figure 4 Panel B: MAIN UNCONDTIIONAL [SUMMER] EVENT STUDY DROPPING 2010
. ********************************************************************************
. 
. preserve

. xtreg extraction plus* i.year#i.county event_treatment i.inside minus6 minus5 minus4 mi
> nus3 if year <2017, fe cluster(parcelnum)
note: plus6 omitted because of collinearity
note: plus7 omitted because of collinearity
note: plus8 omitted because of collinearity
note: plus9 omitted because of collinearity
note: 2016.year#2.county_code omitted because of collinearity
note: 1.inside omitted because of collinearity

Fixed-effects (within) regression               Number of obs     =      6,424
Group variable: parcelnum                       Number of groups  =        584

R-sq:                                           Obs per group:
     within  = 0.0538                                         min =         11
     between = 0.0408                                         avg =       11.0
     overall = 0.0001                                         max =         11

                                                F(30,583)         =       4.16
corr(u_i, Xb)  = -0.0928                        Prob > F          =     0.0000

                                (Std. Err. adjusted for 584 clusters in parcelnum)
----------------------------------------------------------------------------------
                 |               Robust
      extraction |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
-----------------+----------------------------------------------------------------
           plus1 |  -8.712452   6.172186    -1.41   0.159    -20.83488    3.409977
           plus2 |  -8.176761   5.480521    -1.49   0.136    -18.94073    2.587208
           plus3 |  -7.868693   5.496578    -1.43   0.153     -18.6642    2.926813
           plus4 |  -13.62685   5.455602    -2.50   0.013    -24.34188   -2.911819
           plus5 |  -16.65348   5.431219    -3.07   0.002    -27.32062   -5.986345
           plus6 |          0  (omitted)
           plus7 |          0  (omitted)
           plus8 |          0  (omitted)
           plus9 |          0  (omitted)
                 |
year#county_code |
         2005 2  |   1.391968    1.08309     1.29   0.199    -.7352651      3.5192
         2006 1  |   1.877037   1.998055     0.94   0.348    -2.047226      5.8013
         2006 2  |   2.880867   1.085718     2.65   0.008     .7484717    5.013263
         2007 1  |   6.766434   2.464003     2.75   0.006     1.927029    11.60584
         2007 2  |   5.386527   1.312221     4.10   0.000     2.809271    7.963783
         2008 1  |    3.60495   1.845942     1.95   0.051    -.0205568    7.230457
         2008 2  |   3.071635   1.135868     2.70   0.007     .8407425    5.302527
         2009 1  |   2.224588    2.56251     0.87   0.386    -2.808287    7.257463
         2009 2  |    2.87089   1.065711     2.69   0.007     .7777899     4.96399
         2011 1  |  -6.436777   2.304348    -2.79   0.005    -10.96261   -1.910941
         2011 2  |  -1.445304   .9611778    -1.50   0.133    -3.333097    .4424887
         2012 1  |  -4.075114   2.655904    -1.53   0.125    -9.291418    1.141191
         2012 2  |   .1289899    1.04234     0.12   0.902    -1.918209    2.176188
         2013 1  |  -1.267905   2.650129    -0.48   0.633    -6.472868    3.937058
         2013 2  |   1.347049   1.051759     1.28   0.201    -.7186504    3.412748
         2014 1  |  -2.744338   2.457496    -1.12   0.265    -7.570962    2.082286
         2014 2  |   .5438597    .827348     0.66   0.511    -1.081086    2.168805
         2015 1  |  -.9531097   2.275601    -0.42   0.675    -5.422485    3.516266
         2015 2  |   .8906948   .8464202     1.05   0.293    -.7717095    2.553099
         2016 1  |  -2.899491   2.714461    -1.07   0.286    -8.230805    2.431822
         2016 2  |          0  (omitted)
                 |
 event_treatment |  -8.788647   4.548366    -1.93   0.054    -17.72183    .1445325
        1.inside |          0  (omitted)
          minus6 |   5.994284   5.656732     1.06   0.290    -5.115771    17.10434
          minus5 |   1.854951   4.978603     0.37   0.710    -7.923232    11.63313
          minus4 |    7.53071   5.286748     1.42   0.155    -2.852681     17.9141
          minus3 |   2.643157   4.639923     0.57   0.569    -6.469844    11.75616
           _cons |   31.85495   .9336638    34.12   0.000      30.0212    33.68871
-----------------+----------------------------------------------------------------
         sigma_u |  44.032551
         sigma_e |  18.388146
             rho |  .85150396   (fraction of variance due to u_i)
----------------------------------------------------------------------------------

. *xtreg extraction plus* i.year#i.county event_treatment i.inside minus6 minus5 minus4 m
> inus3, fe cluster(parcelnum)
. 
. *TABLE 6*
. esttab using "Tables\Eventstudy_summer_$outputdate.tex", label replace ///
>         se star(* .10 ** .05 *** .01) ///
>         addnote(Table reports results from event study regression. Standard errors are 
> clustered at the parcel level.) ///
>         cells(b(star fmt(2)) se(par fmt(2)))
(output written to Tables\Eventstudy_summer_20231129.tex)

. eststo clear

. 
. 
. *WALD TESTS
. putexcel set "Tables\pairwise_wald_summer_$outputdate.xlsx", replace
Note: file will be replaced when the first putexcel command is issued

. putexcel B1=2011
file Tables\pairwise_wald_summer_20231129.xlsx saved

. putexcel C1=2012
file Tables\pairwise_wald_summer_20231129.xlsx saved

. putexcel D1=2013
file Tables\pairwise_wald_summer_20231129.xlsx saved

. putexcel E1=2014
file Tables\pairwise_wald_summer_20231129.xlsx saved

. putexcel F1=2015
file Tables\pairwise_wald_summer_20231129.xlsx saved

. putexcel A2=2011
file Tables\pairwise_wald_summer_20231129.xlsx saved

. putexcel A3=2012
file Tables\pairwise_wald_summer_20231129.xlsx saved

. putexcel A4=2013
file Tables\pairwise_wald_summer_20231129.xlsx saved

. putexcel A5=2014
file Tables\pairwise_wald_summer_20231129.xlsx saved

. putexcel A6=2015
file Tables\pairwise_wald_summer_20231129.xlsx saved

. *2011 
. lincom _b[event_treat]-_b[plus1]

 ( 1)  - plus1 + event_treatment = 0

------------------------------------------------------------------------------
  extraction |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
         (1) |   -.076195   3.280553    -0.02   0.981    -6.519336    6.366946
------------------------------------------------------------------------------

. putexcel B3=(r(t)) 
file Tables\pairwise_wald_summer_20231129.xlsx saved

. lincom _b[event_treat]-_b[plus2]

 ( 1)  - plus2 + event_treatment = 0

------------------------------------------------------------------------------
  extraction |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
         (1) |  -.6118862   3.201912    -0.19   0.849    -6.900574    5.676802
------------------------------------------------------------------------------

. putexcel B4=(r(t))
file Tables\pairwise_wald_summer_20231129.xlsx saved

. lincom _b[event_treat]-_b[plus3]

 ( 1)  - plus3 + event_treatment = 0

------------------------------------------------------------------------------
  extraction |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
         (1) |  -.9199539   3.548779    -0.26   0.796    -7.889902    6.049995
------------------------------------------------------------------------------

. putexcel B5=(r(t)) 
file Tables\pairwise_wald_summer_20231129.xlsx saved

. lincom _b[event_treat]-_b[plus4]

 ( 1)  - plus4 + event_treatment = 0

------------------------------------------------------------------------------
  extraction |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
         (1) |   4.838201   3.497117     1.38   0.167    -2.030281    11.70668
------------------------------------------------------------------------------

. putexcel B6=(r(t)) 
file Tables\pairwise_wald_summer_20231129.xlsx saved

. *2012
. lincom _b[plus1]-_b[plus2]

 ( 1)  plus1 - plus2 = 0

------------------------------------------------------------------------------
  extraction |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
         (1) |  -.5356912   4.075903    -0.13   0.895    -8.540934    7.469552
------------------------------------------------------------------------------

. putexcel C4=(r(t)) 
file Tables\pairwise_wald_summer_20231129.xlsx saved

. lincom _b[plus1]-_b[plus3]

 ( 1)  plus1 - plus3 = 0

------------------------------------------------------------------------------
  extraction |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
         (1) |  -.8437589   4.278042    -0.20   0.844     -9.24601    7.558492
------------------------------------------------------------------------------

. putexcel C5=(r(t))
file Tables\pairwise_wald_summer_20231129.xlsx saved

. lincom _b[plus1]-_b[plus4]

 ( 1)  plus1 - plus4 = 0

------------------------------------------------------------------------------
  extraction |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
         (1) |   4.914396   4.512726     1.09   0.277    -3.948784    13.77758
------------------------------------------------------------------------------

. putexcel C6=(r(t)) 
file Tables\pairwise_wald_summer_20231129.xlsx saved

. *2013
. lincom _b[plus2]-_b[plus3]

 ( 1)  plus2 - plus3 = 0

------------------------------------------------------------------------------
  extraction |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
         (1) |  -.3080677   3.470976    -0.09   0.929    -7.125209    6.509074
------------------------------------------------------------------------------

. putexcel D5=(r(t))
file Tables\pairwise_wald_summer_20231129.xlsx saved

. lincom _b[plus2]-_b[plus4]

 ( 1)  plus2 - plus4 = 0

------------------------------------------------------------------------------
  extraction |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
         (1) |   5.450087   3.505203     1.55   0.121    -1.434276    12.33445
------------------------------------------------------------------------------

. putexcel D6=(r(t)) 
file Tables\pairwise_wald_summer_20231129.xlsx saved

. *2014
. lincom _b[plus3]-_b[plus4]

 ( 1)  plus3 - plus4 = 0

------------------------------------------------------------------------------
  extraction |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
         (1) |   5.758155   3.239657     1.78   0.076    -.6046651    12.12097
------------------------------------------------------------------------------

. putexcel E6=(r(t)) 
file Tables\pairwise_wald_summer_20231129.xlsx saved

. 
. 
. mat coeff = [ _b[minus6] \_b[minus5] \ _b[minus4] \ _b[minus3] \ 0 \ _b[event_treatment
> ] ///
>                         \ _b[plus1] \ _b[plus2] \ _b[plus3] \ _b[plus4] \_b[plus5]  \_b
> [plus6] \_b[plus7] \_b[plus8] \_b[plus9]]

.                 
. mat se = [ _se[minus6]  \_se[minus5] \ _se[minus4] \ _se[minus3] \ 0 \ _se[event_treatm
> ent] ///
> \ _se[plus1] \ _se[plus2] \ _se[plus3] \ _se[plus4] \_se[plus5] \_se[plus6] \_se[plus7]
>  \_se[plus8] \_se[plus9]]

. 
. 
. mat upper=coeff+((1.645)*se)

. mat lower=coeff-((1.645)*se)

. 
. *mat upper=coeff+((1.96)*se)
. *mat lower=coeff-((1.96)*se)
. mat x=(-6\-5\-4\-3\-2\0\1\2\3\4\5\6\7\8\9)

. mat data=[coeff,upper,lower,x]

. svmat data

. rename data1 coeff

. rename data2 upper

. rename data3 lower

. rename data4 x

. 
. matrix colnames data=beta loCI highCI year

. matrix list data

data[15,4]
           beta        loCI      highCI        year
 r1   5.9942843   15.299608  -3.3110399          -6
 r2   1.8549508   10.044753  -6.3348513          -5
 r3   7.5307101    16.22741  -1.1659902          -4
 r4   2.6431565    10.27583  -4.9895167          -3
 r5           0           0           0          -2
 r6   -8.788647  -1.3065846   -16.27071           0
 r7  -8.7124521   1.4407941  -18.865698           1
 r8  -8.1767608   .83869553  -17.192217           2
 r9  -7.8686931   1.1731769  -16.910563           3
r10  -13.626848  -4.6523819  -22.601313           4
r11  -16.653484  -7.7191288   -25.58784           5
r12           0           0           0           6
r13           0           0           0           7
r14           0           0           0           8
r15           0           0           0           9

. putexcel set "Tables\water_eventstudy_cy_90_$outputdate.xlsx", sheet(summer) modify

. putexcel A1 = matrix(data)
file Tables\water_eventstudy_cy_90_20231129.xlsx saved

. clear

. svmat data, names(col)
number of observations will be reset to 15
Press any key to continue, or Break to abort
number of observations (_N) was 0, now 15

. 
. replace year = 2005 if year ==-6
(1 real change made)

. replace year = 2006 if year ==-5
(1 real change made)

. replace year = 2007 if year ==-4
(1 real change made)

. replace year = 2008 if year ==-3
(1 real change made)

. replace year = 2009 if year ==-2
(1 real change made)

. replace year = 2010 if year ==-1
(0 real changes made)

. replace year = 2011 if year ==0
(1 real change made)

. replace year = 2012 if year ==1
(1 real change made)

. replace year = 2013 if year ==2
(1 real change made)

. replace year = 2014 if year ==3
(1 real change made)

. replace year = 2015 if year ==4
(1 real change made)

. replace year = 2016 if year ==5
(1 real change made)

. replace year = 2017 if year ==6
(1 real change made)

. replace year = 2018 if year ==7
(1 real change made)

. replace year = 2019 if year ==8
(1 real change made)

. replace year = 2020 if year ==9
(1 real change made)

. 
. twoway (rcap loCI highCI year if year <2016) (scatter beta year if year <2016, msymbol(
> triangle) msize(small)), ///
> ytitle(Extraction (AF)) ///
>  scheme(s1color) legend(label (1 90% CI from t-test) label (2 Difference Inside and Out
> side)) ///
>         xtitle(Year) title(B. Summer) yline(0, lcolor(black)) xlab(2005(2)2015) ylab(-3
> 0(10)20)

. graph save "Figures\ES_su_cy_90_$outputdate.gph", replace
(file Figures\ES_su_cy_90_20231129.gph saved)

. graph export "Figures\ES_su_cy_90_$outputdate.png", replace
(file Figures\ES_su_cy_90_20231129.png written in PNG format)

. restore

. 
. 
. *Combine main figs to one 2-panel figure:
. graph combine "Figures\ES_ann_cy_90_$outputdate.gph"  "Figures\ES_su_cy_90_$outputdate.
> gph" , xcommon rows(2) cols(1) 

. graph display, ysize(18) xsize(15) scheme(s1color) 

. graph save "Figures\ES_combine_$outputdate.gph", replace
(file Figures\ES_combine_20231129.gph saved)

. graph export "Figures\ES_combine_$outputdate.png", width(4000) replace
(file Figures\ES_combine_20231129.png written in PNG format)

. 
. log close
      name:  <unnamed>
       log:  D:\Ellen\Dropbox\Pajaro_AgInnovation\Submission\JAERE\Replication_Code\Log\E
> vent_study_log.log
  log type:  text
 closed on:  29 Nov 2023, 14:03:16
-----------------------------------------------------------------------------------------
